package main

import (
	"fmt"
	"io/ioutil"
	"src/lex"
	"src/token"
)

func main() {
	src, err := ioutil.ReadFile("linkage_client.c")

	if err != nil {
		fmt.Println("readfile failed", err)
		return
	}

	lexer := lex.NewLexer(string(src))

	for {
		tok, pos, val := lexer.Scan()
		if tok == token.EOF {
			break
		}
		if tok > token.Tkey_words_beg && tok < token.Tkey_words_end {
			fmt.Println("get tok=", tok, " pos=", pos, " val=", val, " len=", len(val))
		}
	}

	fmt.Println("scan over")
}
